<!-- 滑动切换选项卡演示(标准写法) -->
<template>
	<view class="" style="background-color: #F8F8F8;">
		<u-navbar :border-bottom="false" title="拒绝原因" :title-size="36" :background="{'background':'#F8F8F8'}" :title-bold="true"
		 :title-color="textColor" >
		</u-navbar>
		<view class="u-p-35" style="background-color: #fff;">
			<view class="u-font-32 text-bold" style="height: 90rpx; line-height: 90rpx;">
				拒绝原因
			</view>
			<view >
				<textarea v-model="reason" style="width: 100%;height: 300rpx;"
					placeholder-style="font-size:30rpx;color: #CCCCCC;" placeholder="请输入其他原因" />
			</view>
			
		</view>
		<!-- 提交 -->
		<view class="btn-container" style="padding: 35rpx 35rpx 100rpx 35rpx">
			<u-button shape="circle" :hair-line="false" hover-class="none" :ripple="true"
				:custom-style="getBtStyle('default','',90)" @click="handleSubmit">提交</u-button>
		</view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				reason:'',
			};
		},
		onLoad(option) {
			this.id = option.id;
		},
		methods: {
			async handleSubmit(){
				uni.showLoading({
					title:'loading...'
				});
				if(this.reason == ''){
					uni.hideLoading();
					this.$u.toast('拒绝原因不得为空');
					return false;
				}
				const res = await this.$newHttp.put('api/v1.3/AfterSalesOrder/Approval',{id:this.id,isAgreed:false,approverOpinions:this.reason});
				uni.hideLoading();
				if(res.code===200){
					uni.$emit('rejectOrder');
					uni.navigateBack({
						delta: 1
					})
				}else{
					this.$u.toast(res.erroMessage);
				}
			}	
		}
	}
</script>

<style scoped lang="scss">
	.btn-container{
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		border-top: 1rpx solid #eaeeea;
		background: #fff;
	}
	
</style>
